package updateDatabases;

import java.util.HashMap;
import java.util.Map;

/**
 * Gets the list of games from the Database.
 * 
 * @author Yahweh Yago
 * 
 */

public class GetTheListGames {

  /*
   * Executes the query to get the list of games.
   * 
   * @param params the order of the list to return.
   */
  protected String[] execute(String... params) {
    String listType = (params.length > 0) ? params[0] : "";

    Map<String, String> requestParams = new HashMap<String, String>();
    requestParams.put("list", listType);
    String response =
        Ajax.send("http://ratethatgame.web44.net/ics414/getGameList.php", requestParams);
    if (response != null) {
      String[] gameList = response.split(",");
      return gameList;
    }
    return null;
  }

}
